<?php
namespace field\variable;

use field\variable\BaseField;
use Utils\AjaxMsg;

class TextField extends BaseField {
    public $name;
    public $description;
    public $extra;
    public $value;

    public function __construct($name, $description, $extra){
        $this->name = $name;
        $this->description = $description;
        $this->extra = $extra;
    }

    /**
     * 转换输入数据
     */
    public function parse($data){
        return $this->value;
    }

    /**
     * 转为string输出
     */
    public function toString(){
        return $this->value;
    }

    /**
     * 转为数据库格式
     */
    public function toDatabase(){
        return $this->value;
    }

    /**
     * 获取数据库的数据类型
     */
    public function getDatabaseType(){
        return 'text';
    }

    public static function getBaseName(){
        return '文本';
    }
}